<div id="main">
<div id="contents">
<form name="filters" action="#" method="post" id="form" >
<fieldset>
<legend>&#160;<label sid="wan.connection_type"></label>&#160;</legend>
<div class="frame_tab_layer">
          <table width="100%" border="0" cellpadding="0" cellspacing="0" class="cmenutitle">
             <tr class="even_line">
              <td class="frame_tab_right">
                <select name="id2024" id="id2024" onchange="changeConnectionType();">
              	<option value="STATIC" sid="wan.connection_type_static"></option>
              	<option value="DHCP" selected sid="wan.connection_type_dhcp"></option>
              	<option value="PPPOE" sid="wan.connection_type_pppoe"></option>
              	<option value="L2TP" sid="wan.connection_type_l2tp"></option>
              	<option value="PPTP" sid="wan.connection_type_pptp"></option>
              	<option value="3G" sid="wan.connection_type_3G" id="3G_connection"></option>
              	</select></td>
            </tr>
          </table>
          <div id="divdhcpid" >
          <!--dhcp-->
            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="cmenutitle" id="dhcpid">
            <tr>
              <td class="frame_tab_left" ><span class="errormsg" id="img2021">&#160;</span>&#160;<label for="id2021" sid="inet.hostname">
              </label>
              </td>
              <td class="frame_tab_right"><input name="id2021" id="id2021" type="text" size="17" maxlength="15"/></td>
            </tr>
          </table>
         </div>
           <div id="divstaticid" style="display:none">
            <!--static-->
  
       		 </div>
          	<div id="divpppoeid" style="display:none">
  
   		  	 </div>
            <!--L2TP-->
            <div id="divl2tpid" style="display:none">
 
      	  </div>
            <!--PPTP-->
            <div id="divpptpid" style="display:none">
            
			</div>  
            <!--3G-->
            <div id="div3gid" style="display:none">
         
          </div>
            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="cmenutitle">
            <tr><td colspan="2"></td></tr>
            <tr>
				<td class="frame_tab_center" colspan="2">
					<input class="button" type="button" name="submit1" sid="sbutton.save" id="save_submit"/>
				</td>
			</tr>
          </table>
            </div>
		</fieldset>
    <fieldset id="3g_escape">
        <legend>&#160;<label sid="wan.G3_escape"></label>&#160;</legend>
        <div class="frame_tab_layer">
            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="cmenutitle">
                <tr>
                    <td class="frame_tab_left" ><label for="id2058"></label>
                    </td>
                    <td class="frame_tab_right">
                        <input name="id2058" id="id2058_1" type="radio" value="on"/>&#160;<label sid="main.enable"></label>
                        <span style="padding-left:20px;"></span>
                        <input name="id2058" id="id2058_2" type="radio" value="off"/>&#160;<label sid="main.disable"></label>
                    </td>
                </tr>
                <tr>
                    <td class="frame_tab_left" ><label sid="wan.G3_ISP"></label></td>
                    <td class="frame_tab_right">
                        <select name="id2046" id="id2046_1" disabled onchange="changeISP_3g();">
                            <option value="0" sid="wan.G3_ISP_select1"></option>
                            <option value="1" sid="wan.G3_ISP_select2"></option>
                            <option value="99" sid="wan.G3_ISP_select3"></option>
                        </select>
                        <input class="button" type="button" name="edit_1" sid="sbutton.modify" value="" onclick="edits2();"/>
                    </td></tr>
                <tr>
                    <td class="frame_tab_left" ><label sid="wan.G3_dial"></label></td>
                    <td class="frame_tab_right">
                        <input name="id2048" id="id2048_1" type="text" size="17" maxlength="15" readonly style="background-color: rgb(204, 204, 204);" />&nbsp;
                        <input class="button" type="button" name="edit_1" sid="sbutton.modify" value="" onclick="edits('id2048_1');"/>
                    </td>
                </tr>

              <tr>
                  <td class="frame_tab_left" >
                      <label sid="wan.G3_user"></label></td>
                  <td class="frame_tab_right">
                      <input name="id2050" id="id2050_1" type="text" size="17" maxlength="15" readonly  style="background-color: rgb(204, 204, 204);"/>
                      &nbsp;<input class="button" type="button" name="edit_2"  sid="sbutton.modify" value="" onclick="edits('id2050_1');"/>
                  </td>
                  </tr>
                <tr>
                    <td class="frame_tab_left" ><label sid="wan.G3_pass"></label></td>
                    <td class="frame_tab_right">
                        <input name="id2051" id="id2051_1" type="text" size="17" maxlength="15" readonly  style="background-color: rgb(204, 204, 204);"/>
                        &nbsp;<input class="button" type="button" name="edit_3" sid="sbutton.modify" value="" onclick="edits('id2051_1');"/>
                    </td>
                </tr>


                <tr><td colspan="2"></td></tr>
                <tr>
                    <td class="frame_tab_center" colspan="2">
                        <!--<script type="text/javascript">document.write("<input class=\"button\" type=\"button\" name=\"submit2\" value=\"" +sbutton.save+ "\" />");</script>!-->
                        <input class="button" type="button" name="submit_3G" sid="sbutton.save" value="" />
                    </td>
                </tr>
            </table>
        </div>
    </fieldset>
		<!--	<fieldset>
<legend>&#160;<label sid="wan.nat"></label>&#160;</legend>
<div class="frame_tab_layer">
          <table width="100%" border="0" cellpadding="0" cellspacing="0" class="cmenutitle">
            <tr>
              <td class="frame_tab_left" ><label for="id2007"></label>
              </td>
              <td class="frame_tab_right">
              	<input name="id2007" id="id2007_1" type="radio" value="1"/>&#160;<label sid="main.enable"></label>
              	<span style="padding-left:20px;"></span>
              	<input name="id2007" id="id2007_2" type="radio" value="0"/>&#160;<label sid="main.disable"></label>
              </td>
            </tr>
             &lt;!&ndash;<tr id="trid2008">
              <td class="frame_tab_left" ><label for="id2008"><script type="text/javascript">Capture(wan.nat_tcp)</script></label>
              </td>
              <td class="frame_tab_right"><input name="id2008" id="id2008" type="text" size="17" maxlength="17" value="180"/></td>
            </tr>
            <tr id="trid2009">
              <td class="frame_tab_left" ><label for="id2009"><script type="text/javascript">Capture(wan.nat_udp)</script></label>
              </td>
              <td class="frame_tab_right"><input name="id2009" id="id2009" type="text" size="17" maxlength="17" value="180"/></td>
            </tr>&ndash;&gt;
             <tr><td colspan="2"></td></tr>
            <tr>
				<td class="frame_tab_center" colspan="2">
					&lt;!&ndash;<script type="text/javascript">document.write("<input class=\"button\" type=\"button\" name=\"submit2\" value=\"" +sbutton.save+ "\" />");</script>!&ndash;&gt;
				<input class="button" type="button" name="submit2" sid="sbutton.save" value="" />
				</td>
			</tr>
          </table>
			</div>
		</fieldset>-->
		<fieldset>
<legend>&#160;<label sid="wan.mac_clone"></label>&#160;</legend>
<div class="frame_tab_layer">
          <table width="100%" border="0" cellpadding="0" cellspacing="0" class="cmenutitle">
             <tr id="trid2022">
              <td class="frame_tab_left" ><label for="id2022"></label>
              </td>
              <td class="frame_tab_right">
              	<input type="radio" name="id2022" id="id2022_1" value="1" onclick="disablemac();"/><label sid="main.enable"></label>
  				<span style="padding-left:5px;"></span>
  				<input type="radio" name="id2022" id="id2022_2" value="0" onclick="disablemac();" checked /><label sid="main.disable"></label>
  				
  			</td>
            </tr>
            <tr id="trid2023">
              <td class="frame_tab_left" ><label for="id2023" sid="inet.mac"></label>
              </td>
              <td class="frame_tab_right">
              	<input name="id2023" id="id2023" type="text" size="17" maxlength="17"/>&nbsp;<br>
              	<input class="button" type="button" name="getmac" sid="sbutton.getmac" value="" onclick="getmacs();"/><br>
                  <span class="x-form-tip" id="id2023Tip"></span>
              	</td>
            </tr>
             <tr><td colspan="2"></td></tr>
            <tr>
				<td class="frame_tab_center" colspan="2">
					<!--<script type="text/javascript">document.write("<input class=\"button\" type=\"button\" name=\"submit3\" value=\"" +sbutton.save+ "\" />");</script>!-->
		<input class="button" type="button"  sid="sbutton.save" name="submit3" value="" />
				</td>
			</tr>
          </table>
			</div>
		</fieldset>
<br/>
</form>
</div>
</div>
<br/>
<div id="helpContainer">
<div id="help">
<div><h2><img src="images/help_title.png" border="0"/><label sid="share.help"></label></h2></div>
 <div id="helpBody">
<dl>

<dt class="term"><label sid="wan.connection_type"></label></dt>
<dd class="definition"><label sid="wan.connection_typeTip"></label></dd>
<dt class="term"><label sid="wan.nat"></label></dt>
<dd class="definition"><label sid="wan.nat_note"></label></dd>
<dt class="term"><label sid="wan.mac_clone"></label></dt>
<dd class="definition"><label sid="wan.mac_clone_note"></label></dd>
</dl>
 </div>
</div>
</div>
<script type="text/javascript">
       var values2058='';
   $(document).ready(function(){

       initOption();
       var value2073 = '';var value2074="";
       var nonames = new Array("submit1","submit2","submit3","submit_3G","id2053_1","id2053_2","getmac","id2030","id2031","confirm","edit_1","edit_2","edit_3");
       var sendtext = getSendText(nonames);
       sendtext += "&id=2030&id=2031&id=2053&id=2073&id=2074&id=2058";
       DataRequest("get_json",sendtext,function(data){
           getResult(nonames,data);
           changeConnectionType();
           //disablenat();
           disablemac();
           //changeISP();
           read();
           var values2053 = data["id2053"];
           values2058 = data["id2058"];
           values2058 === "on" ? $("#3G_connection").hide() :$("#3G_connection").show();
           $("input[name='id2058'][value='"+values2058+"']").attr("checked",true);
           value2073 = data["id2073"];
           value2074 = data["id2074"];
           var values2030 = data["id2030"];
           var values2031 = data["id2031"];
           if(values2030=="pppoe_user"){
               values2030="";
           }

           if(values2031=="pppoe_passwd"){
               values2031="";
           }
           updatecfgvalue("id2030",values2030);
           updatecfgvalue("id2031",values2031);
           if($("#id2052_radio1").attr("checked")){
               updatecfgvalue("id2053_1",values2053);
           }else if(parseInt(values2053) >= 60){
               var value2053 = parseInt(values2053)/60;
               updatecfgvalue("id2053_2",value2053);
           }
           if($("#id2053_1").val()==""){
               $("#id2053_1").attr("value","60");
           }
           if($("#id2053_2").val()==""){
               $("#id2053_2").attr("value","5");
           }
           if($("#id2055").val()==""){
               $("#id2055").attr("value","60");
           }
           if($("#id2057").val()==""){
               $("#id2057").attr("value","60");
           }
       });

       $.formValidator.initConfig({debug:false,submitOnce:true,submitButtonID:"save_submit",
           onError:function(msg, obj, errorlist) {

           },
           onSuccess:function(){
               var settext = "&id2024="+$("#id2024").val();
               if($.trim($("#id2024").val())=="PPPOE"){
                   var value2053 = "";
                   if($("#id2052_radio1").attr("checked")){
                       value2053 = $("#id2053_1").val();
                       settext += "&id2052="+$("#id2052_radio1").val()+"&id2053="+value2053;
                   }else if($("#id2052_radio2").attr("checked")){
                       value2053 = parseInt($("#id2053_2").val())*60;
                       settext += "&id2052="+$("#id2052_radio2").val()+"&id2053="+value2053;
                   }else if($("#id2052_radio3").attr("checked")){
                       value2053="";
                       settext += "&id2052="+$("#id2052_radio3").val()+"&id2053="+value2053;
                   }
                   settext +="&id2030="+$("#id2030").val()+"&id2031="+$("#id2031").val();


               }else if($.trim($("#id2024").val())=="DHCP"){
                   settext+="&id2021="+$("#id2021").val();

               }else if($.trim($("#id2024").val())=="STATIC"){
                   var value2025 = $("#id2025").val();
                   var value2026 = $("#id2026").val();
                   if(checkNet(value2073,value2074,value2025,value2026)==2){
                       alert(msg.lanip_wanip);
                       return false;
                   }
                       settext+="&id2025="+$("#id2025").val()+"&id2026="+$("#id2026").val()+"&id2027="+$("#id2027").val()+"&id2028="+$("#id2028").val()+"&id2029="+$("#id2029").val();

               }else if($.trim($("#id2024").val())=="L2TP"){
                   var vlaue2035 = "";
                   var value2054 = "";
                   if($("#id2035_1").attr("checked")){
                       value2035 = "0";
                   }else{
                       value2035 = "1";
                   }
                   if($("#id2054_radio1").attr("checked")){
                       value2054 = "KeepAlive";
                   }else{
                       value2054 = "Manual";
                   }

                   if(checkNet(value2073,value2074,$("#id2036").val(),$("#id2037").val())==2){
                       alert(msg.lanip_wanip);
                       return false;
                   }
                   settext+="&id2032="+$("#id2032").val()+"&id2033="+$("#id2033").val()+"&id2034="+$("#id2034").val()+"&id2036="+$("#id2036").val()+"&id2037="+$("#id2037").val()+"&id2038="+$("#id2038").val()+"&id2035="+value2035+"&id2054="+value2054+"&id2055="+$("#id2055").val();

               }else if($.trim($("#id2024").val())=="PPTP"){
                   var value2042 = "";
                   var value2056 = "";
                   if($("#id2042_1").attr("checked")){
                       value2042 = "0";
                   }else{
                       value2042 = "1";
                   }
                   if($("#id2056_radio1").attr("checked")){
                       value2056 = "KeepAlive";
                   }else{
                       value2056 = "Manual";
                   }
                   if(checkNet(value2073,value2074,$("#id2043").val(),$("#id2044").val())==2){
                       alert(msg.lanip_wanip);
                       return false;
                   }
                   settext+="&id2039="+$("#id2039").val()+"&id2040="+$("#id2040").val()+"&id2041="+$("#id2041").val()+"&id2043="+$("#id2043").val()+"&id2044="+$("#id2044").val()+"&id2045="+$("#id2045").val()+"&id2042="+value2042+"&id2056="+value2056+"&id2057="+$("#id2057").val();

               }else if($.trim($("#id2024").val())=="3G"){
                   settext+="&id2047="+$("#id2047").val()+"&id2048="+$("#id2048").val()+"&id2049="+$("#id2049").val()+"&id2050="+$("#id2050").val()+"&id2051="+$("#id2051").val()+"&id2046="+$("#id2046").val();

               }
               submitvalue(settext);
           }
       });
       $("#save_submit").bind("mouseover",function(){
          $("#id2023").unFormValidator(true);
       });
       $("#save_submit").bind("mouseout",function(){
           if( $("input[name='id2022']:checked").val()!=0){
           $("#id2023").unFormValidator(false);
           }
       });
       $("#id2023").formValidator({
           onFocus:errmsg.Info7
       }).regexValidator({
                   regExp:regexEnum.notempty,
                   onError:errmsg.Info3

               }).regexValidator({
                   regExp:regexEnum.mac,
                   onError:errmsg.Info1

               });

       $("[name=confirm]").click(function () {
           alert($("#id2031").val());
       });
       $("[name=submit2]").click(function () {
           var value2007 = "";
           if($("#id2007_1").attr("checked")){
               value2007 = "1";
           }else{
               value2007 = "0";
           }
           var settext="&id2007="+value2007;
           submitvalue(settext);
       });

      $("[name=submit_3G]").click(function(){
           var value2058 =$("input[name='id2058']:checked").val();
           var value2046 =$("#id2046_1").val();
           var value2048 =$("#id2048_1").val();
           var value2050 =$("#id2050_1").val();
           var value2051=$("#id2051_1").val();
           var settext="&id2058="+value2058+"&id2046="+value2046+"&id2048="+value2048+"&id2050="+value2050+"&id2051="+value2051
          submitvalue(settext);


      });

       $("[name=submit3]").click(function () {
           var value2022 = "";
           if($("#id2022_1").attr("checked")){
               value2022 = "1";
           }else{
               value2022 = "0";
           }
           if($("#id2023Tip").hasClass("onError")){
               $("#id2023").focus();
           } else{
           var settext="&id2022="+value2022+"&id2023="+$("#id2023").val().replace(new RegExp("-","g"),":");
           submitvalue(settext);
           }
       });
   });
function initOption(){
		var divstaticid = [],divpppoeid = [],divl2tpid=[],divpptpid=[],div3gid=[];
				divstaticid.push('<table width="100%" border="0" cellpadding="0" cellspacing="0" class="cmenutitle" id="staticid">');
				divstaticid.push('<tr><td class="frame_tab_left" >');
                divstaticid.push('<span class="errormsg" id="img2025">&#160;</span>&#160;<label sid="inet.ip"></label></td>');
                divstaticid.push('<td class="frame_tab_right">');
                divstaticid.push('<input name="id2025" id="id2025" type="text" size="17" maxlength="15"/>');
                divstaticid.push('<span class="x-form-tip" id="id2025Tip"></span>');
                divstaticid.push('</td></tr>');
				divstaticid.push('<tr><td class="frame_tab_left" ><span class="errormsg" id="img2026">&#160;</span>&#160;<label sid="inet.netmask"></label></td> <td class="frame_tab_right"><input name="id2026" id="id2026" type="text" size="17"/><span class="x-form-tip" id="id2026Tip"></span></td></tr>');
				divstaticid.push('<tr><td class="frame_tab_left" ><span class="errormsg" id="img2027">&#160;</span>&#160;<label sid="inet.gateway"></label></label></td><td class="frame_tab_right"><input name="id2027" id="id2027" type="text" size="17"/><span class="x-form-tip" id="id2027Tip"></span></td></tr>');
				divstaticid.push('<tr><td class="frame_tab_left" ><span class="errormsg" id="img2028">&#160;</span>&#160;<label sid="inet.pri_dns"></label></td><td class="frame_tab_right"><input name="id2028" id="id2028" type="text" size="17"/><span class="x-form-tip" id="id2028Tip"></span></td></tr>');
				divstaticid.push('<tr><td class="frame_tab_left" ><span class="errormsg" id="img2029">&#160;</span>&#160;<label sid="inet.sec_dns"></label></td><td class="frame_tab_right"><input name="id2029" id="id2029" type="text" size="17"/><span class="x-form-tip" id="id2029Tip"></span></td></tr></table>');
			 $("#divstaticid").html(divstaticid.join(""));
				divpppoeid.push('<table width="100%" border="0" cellpadding="0" cellspacing="0" class="cmenutitle" id="pppoeid">');
				divpppoeid.push('<tr><td class="frame_tab_left" ><span class="errormsg" id="img2030">&#160;</span>&#160;<label sid="wan.pppoe_user"></label></td><td class="frame_tab_right"><input name="id2030" id="id2030" type="text" size="17" maxlength="40"/></td></tr>');
				divpppoeid.push('<tr><td class="frame_tab_left" ><span class="errormsg" id="img2031">&#160;</span>&#160;<label sid="wan.pppoe_pass"></label></td><td class="frame_tab_right"><input name="id2031" id="id2031" type="password" size="17" maxlength="40"/><span style="padding-left:10px;"></span><input class="button" type="button" name="confirm" sid="wan.pppoe_confirm" value="'+wan.pppoe_confirm+'"></td></tr>');
				divpppoeid.push('<tr><td colspan="2" class="frame_tab_right"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="cmenutitle"><tr><td align="left"><span style="padding-left:20px;"></span><input type="radio" name="id2052" id="id2052_radio1" value="KeepAlive"  checked /><label sid="wan.pppoe_keepalive"></label></td></tr>');
				divpppoeid.push('<tr><td align="left"><span style="padding-left:40px;"></span><label sid="wan.pppoe_keepalive_select"></label><input type="text" name="id2053_1" id="id2053_1" maxlength="6" size="6" value="60"/><label sid="wan.pppoe_secondes"></label></td></tr>');
				divpppoeid.push('<tr><td align="left"><span style="padding-left:20px;"></span><input type="radio" name="id2052" id="id2052_radio2" value="OnDemand"/><label sid="wan.pppoe_demand"></label></td></tr>');
			    divpppoeid.push('<tr><td align="left"><span style="padding-left:40px;"></span><label sid="wan.pppoe_demand_select1"></label><input type="text" name="id2053_2" id="id2053_2" maxlength="6" size="6" value="5"/><label sid="wan.pppoe_demand_select2"></label></td></tr>');
			  divpppoeid.push('<tr><td align="left"><span style="padding-left:20px;"></span><input type="radio" name="id2052" id="id2052_radio3" value="Manual"/><label sid="wan.pppoe_manual"></label></td></tr>');
			  divpppoeid.push('<tr><td align="left"><span style="padding-left:40px;"></span><label sid="wan.pppoe_manual_select"></label></td></tr></table></td></tr></table> ');
	 			$("#divpppoeid").html(divpppoeid.join(""));
				divl2tpid.push('<table width="100%" border="0" cellpadding="0" cellspacing="0" class="cmenutitle" id="l2tpid">');
				divl2tpid.push('<tr><td class="frame_tab_left" ><label sid="inet.server"></label></td><td class="frame_tab_right"><input name="id2032" id="id2032" type="text" size="17" maxlength="15"/></td></tr>');
				divl2tpid.push('<tr><td class="frame_tab_left" ><label sid="inet.user"></label></td><td class="frame_tab_right"><input name="id2033" id="id2033" type="text" size="17" maxlength="15"/></td></tr>');
				divl2tpid.push('<tr><td class="frame_tab_left" ><label sid="inet.password"></label></td><td class="frame_tab_right"><input name="id2034" id="id2034" type="password" size="17" maxlength="15"/></td></tr>');
				divl2tpid.push('<tr><td class="frame_tab_left" ><label sid="wan.address_mode"></label></td><td class="frame_tab_right"><input type="radio" name="id2035" id="id2035_1"  value="0" onclick="read();"/>&#160;<label sid="wan.address_mode_static"></label><span style="padding-left:20px;"></span><input type="radio" name="id2035" id="id2035_2" value="1" onclick="read();"/>&#160;<label sid="wan.address_mode_dynamic"></label></td></tr>');
				divl2tpid.push('<tr id="tr2036"><td class="frame_tab_left" ><label sid="inet.ip"></label></td><td class="frame_tab_right"><input name="id2036" id="id2036" type="text" size="17" maxlength="15"/><span class="x-form-tip" id="id2036Tip"></span></td></tr>');
				divl2tpid.push('<tr id="tr2037"><td class="frame_tab_left" ><label sid="inet.netmask"></label></td><td class="frame_tab_right"><input name="id2037" id="id2037" type="text" size="17" maxlength="15"/><span class="x-form-tip" id="id2037Tip"></span></td></tr>');
				divl2tpid.push('<tr id="tr2038"><td class="frame_tab_left" ><label sid="inet.gateway"></label></td><td class="frame_tab_right"><input name="id2038" id="id2038" type="text" size="17" maxlength="15"/><span class="x-form-tip" id="id2038Tip"></span></td></tr>');
				divl2tpid.push('<tr><td colspan="2" class="frame_tab_right"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="cmenutitle"><tr><td align="left"><span style="padding-left:20px;"></span><input type="radio" name="id2054" id="id2054_radio1" value="KeepAlive" checked /><label sid="wan.pppoe_keepalive"></label></td></tr>');
				divl2tpid.push('<tr><td align="left"><span style="padding-left:40px;"></span><label sid="wan.pppoe_keepalive_select"></label><input type="text" name="id2055" id="id2055" maxlength="6" size="6" value="60"/><label sid="wan.pppoe_secondes"></label></td></tr>');
				divl2tpid.push('<tr><td align="left"><span style="padding-left:20px;"></span><input type="radio" name="id2054" id="id2054_radio2" value="Manual"/><label sid="wan.pppoe_manual"></label></td></tr><tr><td align="left"><span style="padding-left:40px;"></span><label sid="wan.pppoe_manual_select"></label></td></tr></table></td></tr></table>');
				$("#divl2tpid").html(divl2tpid.join(""));
				divpptpid.push('<table width="100%" border="0" cellpadding="0" cellspacing="0" class="cmenutitle" id="pptpid" >');
				divpptpid.push('<tr><td class="frame_tab_left" ><label sid="inet.server"></label></td><td class="frame_tab_right"><input name="id2039" id="id2039" type="text" size="17" maxlength="15"/></td></tr>');
				divpptpid.push('<tr><td class="frame_tab_left" ><label sid="inet.user"></label></td><td class="frame_tab_right"><input name="id2040" id="id2040" type="text" size="17" maxlength="15"/></td></tr>');
				divpptpid.push('<tr><td class="frame_tab_left" ><label sid="inet.password"></label></td><td class="frame_tab_right"><input name="id2041" id="id2041" type="password" size="17" maxlength="15"/></td></tr>');
				divpptpid.push('<tr><td class="frame_tab_left" ><label sid="wan.address_mode"></label></td><td class="frame_tab_right"><input name="id2042" id="id2042_1" type="radio" value="0" onclick="read();"/>&#160;<label sid="wan.address_mode_static"></label><span style="padding-left:20px;"></span><input name="id2042" id="id2042_2" type="radio" value="1" onclick="read();"/>&#160;<label sid="wan.address_mode_dynamic"></label></td></tr>');
				divpptpid.push('<tr id="tr2043"><td class="frame_tab_left" ><label sid="inet.ip"></label></td><td class="frame_tab_right"><input name="id2043" id="id2043" type="text" size="17" maxlength="15"/><span class="x-form-tip" id="id2043Tip"></span></td></tr>');
				divpptpid.push('<tr id="tr2044"><td class="frame_tab_left" ><label sid="inet.netmask"></label></td><td class="frame_tab_right"><input name="id2044" id="id2044" type="text" size="17" maxlength="15"/><span class="x-form-tip" id="id2044Tip"></span></td></tr>');
				divpptpid.push('<tr id="tr2045"><td class="frame_tab_left" ><label sid="inet.gateway"></label></td><td class="frame_tab_right"><input name="id2045" id="id2045" type="text" size="17" maxlength="15"/><span class="x-form-tip" id="id2045Tip"></span></td></tr>');
				divpptpid.push('<tr><td colspan="2" class="frame_tab_right"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="cmenutitle"><tr><td align="left"><span style="padding-left:20px;"></span><input type="radio" name="id2056" id="id2056_radio1" value="KeepAlive" checked /><label sid="wan.pppoe_keepalive"></label></td></tr>');
				divpptpid.push('<tr><td align="left"><span style="padding-left:40px;"></span><label sid="wan.pppoe_keepalive_select"></label><input type="text" name="id2057" id="id2057" maxlength="6" size="6" value="60"/><label sid="wan.pppoe_secondes"></label></td></tr>');
				divpptpid.push('<tr><td align="left"><span style="padding-left:20px;"></span><input type="radio" name="id2056" id="id2056_radio2" value="Manual"/><label sid="wan.pppoe_manual"></label></td></tr>');
				divpptpid.push('<tr><td align="left"><span style="padding-left:40px;"></span><label sid="wan.pppoe_manual_select"></label></td></tr></table></td></tr></table> ');
				$("#divpptpid").html(divpptpid.join(""));
	 			div3gid.push('<table width="100%" border="0" cellpadding="0" cellspacing="0" class="cmenutitle" id="3gid">');
				div3gid.push('<tr><td class="frame_tab_left" ><label sid="wan.G3_ISP"></label></td><td class="frame_tab_right"><select name="id2046" id="id2046" onchange="changeISP();"><option value="0">'+wan.G3_ISP_select1+'</option><option value="1">'+wan.G3_ISP_select2+'</option><option value="99">'+wan.G3_ISP_select3+'</option></select></td></tr>');
/*				div3gid.push('<tr><td class="frame_tab_left" ><label sid="wan.G3_apn"></label></td><td class="frame_tab_right"><input name="id2047" id="id2047" type="text" size="17" maxlength="15"/></td></tr>');*/
				div3gid.push('<tr><td class="frame_tab_left" ><label sid="wan.G3_dial"></label></td><td class="frame_tab_right"><input name="id2048" id="id2048" type="text" size="17" maxlength="15" readonly style="background-color: rgb(204, 204, 204);" />&nbsp;<input class="button" type="button" name="edit_1" sid="sbutton.modify" value="" onclick="edits(\'id2048\');"/></td></tr>')
/*
				div3gid.push('<tr><td class="frame_tab_left" ><label sid="wan.G3_pin"></label></td><td class="frame_tab_right"><input name="id2049" id="id2049" type="text" size="17" maxlength="15"/></td></tr>');
*/
				div3gid.push('<tr><td class="frame_tab_left" ><label sid="wan.G3_user"></label></td><td class="frame_tab_right"><input name="id2050" id="id2050" type="text" size="17" maxlength="15" readonly  style="background-color: rgb(204, 204, 204);"/>&nbsp;<input class="button" type="button" name="edit_2"  sid="sbutton.modify" value="" onclick="edits(\'id2050\');"/></td></tr>');
				div3gid.push('<tr><td class="frame_tab_left" ><label sid="wan.G3_pass"></label></td><td class="frame_tab_right"><input name="id2051" id="id2051" type="text" size="17" maxlength="15" readonly  style="background-color: rgb(204, 204, 204);"/>&nbsp;<input class="button" type="button" name="edit_3" sid="sbutton.modify" value="" onclick="edits(\'id2051\');"/></td></tr>');
/*
                div3gid.push('<tr><td class="frame_tab_left" ><label sid="wan.G3_type"></label></td><td class="frame_tab_right"><input name="id2051" id="id2051" type="text" size="17" maxlength="15" "/>&nbsp;Mb</td></tr>');
*/

                 div3gid.push('</table>');
				$("#div3gid").html(div3gid.join(""));
	}

function getmacs(){
	DataRequest("get_json","&id=465",function(data){
		var localIP = data["id465"];
 	DataRequest("/cgi-bin/stat?getmyMac&"+localIP,"",function(data){
		var tmpvalue = data["mymac"];
		$("#id2023").attr("value",tmpvalue);
	});
});
 	}

function edits(readId){
		 if($("#"+readId).attr("readonly")){
 			$("#"+readId).attr("readonly",false);
 			$("#"+readId).css("background-color","#ffffff");
 			}
		}

function edits2(){
    $("#id2046_1").attr("disabled",false);
}
	
function changeISP(){
           var id2046_val = $("#id2046").val();
           if(id2046_val=="0"){
               $("#id2048").attr("value","#777").attr("readonly",true).css({"backgroundColor":"rgb(204, 204, 204)"});;
               $("#id2050").attr("value","card").attr("readonly",true).css({"backgroundColor":"rgb(204, 204, 204)"});;
               $("#id2051").attr("value","card").attr("readonly",true).css({"backgroundColor":"rgb(204, 204, 204)"});;

           }else if(id2046_val =="1"){

               $("#id2048").attr("value","*99#").attr("readonly",true).css({"backgroundColor":"rgb(204, 204, 204)"});;
               $("#id2050").attr("value","").attr("readonly",true).css({"backgroundColor":"rgb(204, 204, 204)"});;
               $("#id2051").attr("value","").attr("readonly",true).css({"backgroundColor":"rgb(204, 204, 204)"});;

           }else{
               $("#id2050").val("");
               $("#id2048").val("");
               $("#id2051").val("");
               $("#id2048").attr("readonly",false).css({"background":""});
               $("#id2050").attr("readonly",false).css({"background":""});;
               $("#id2051").attr("readonly",false).css({"background":""});;
           }
       }

       function changeISP_3g(){
           var id2046_val = $("#id2046_1").val();
           if(id2046_val=="0"){
               $("#id2048_1").attr("value","#777").attr("readonly",true).css({"backgroundColor":"rgb(204, 204, 204)"});;
               $("#id2050_1").attr("value","card").attr("readonly",true).css({"backgroundColor":"rgb(204, 204, 204)"});;
               $("#id2051_1").attr("value","card").attr("readonly",true).css({"backgroundColor":"rgb(204, 204, 204)"});;

           }else if(id2046_val =="1"){

               $("#id2048_1").attr("value","*99#").attr("readonly",true).css({"backgroundColor":"rgb(204, 204, 204)"});;
               $("#id2050_1").attr("value","").attr("readonly",true).css({"backgroundColor":"rgb(204, 204, 204)"});;
               $("#id2051_1").attr("value","").attr("readonly",true).css({"backgroundColor":"rgb(204, 204, 204)"});;

           }else{
               $("#id2050_1").val("");
               $("#id2048_1").val("");
               $("#id2051_1").val("");
               $("#id2048_1").attr("readonly",false).css({"background":""});
               $("#id2050_1").attr("readonly",false).css({"background":""});;
               $("#id2051_1").attr("readonly",false).css({"background":""});;
           }
       }
	
function disablenat(){
		if( $("input[name='id2007']:checked").val()==0){	
  		$("#trid2008").hide();
  		$("#trid2009").hide();
  	}else{
  		$("#trid2008").show();
  		$("#trid2009").show();
  	}
	}

function disablemac(){
		if( $("input[name='id2022']:checked").val()==0){	
  		$("#trid2023").hide();
        $("#id2023").unFormValidator(true);
  	}else{
  		$("#trid2023").show();
        $("#id2023").unFormValidator(false);
  	}
	}
	
function changeConnectionType(){
        var obj  = {

            init : function(){
            },
            condition : "",
            excute:function(){

                this[this.condition].apply(this);

                this.destroy();

            },

            STATIC:function(){
                $("#divstaticid").show();
                $("#divdhcpid").hide();
                $("#divpppoeid").hide();
                $("#divl2tpid").hide();
                $("#divpptpid").hide();
                $("#div3gid").hide();
                $("#mode").hide();
                $("#3g_escape").show();
                $("#id2025").formValidator({
                    onFocus:errmsg.Info9
                }).regexValidator({
                            regExp:regexEnum.notempty,
                            onError:errmsg.Info3

                        }).regexValidator({
                            regExp:regexEnum.ip4,
                            onError:errmsg.Info1

                        });
                $("#id2026").formValidator({
                    onFocus:errmsg.Info8
                }).regexValidator({
                            regExp:regexEnum.notempty,
                            onError:errmsg.Info3

                        }).regexValidator({
                            regExp:regexEnum.ip4,
                            onError:errmsg.Info1

                        });
                $("#id2027").formValidator({
                    onFocus:errmsg.Info14
                }).regexValidator({
                            regExp:regexEnum.notempty,
                            onError:errmsg.Info3

                        }).regexValidator({
                            regExp:regexEnum.ip4,
                            onError:errmsg.Info1

                        });

                $("#id2036,#id2037,#id2038,#id2043,#id2044,#id2045").unFormValidator(true);
            },

            PPPOE:function(){
                $("#divpppoeid").show();
                $("#3g_escape").show();
                $("#divstaticid").hide();
                $("#divdhcpid").hide();
                $("#divl2tpid").hide();
                $("#divpptpid").hide();
                $("#div3gid").hide();
                $("#mode").hide();
                $("#id2025,#id2026,#id2027,#id2036,#id2037,#id2038,#id2043,#id2044,#id2045").unFormValidator(true);
            },

            L2TP:function(){
                $("#3g_escape").hide();
                $("#divl2tpid").show();
                $("#divstaticid").hide();
                $("#divdhcpid").hide();
                $("#divpppoeid").hide();
                $("#divpptpid").hide();
                $("#div3gid").hide();
                $("#mode").show();
                $("#id2036").formValidator({
                    onFocus:errmsg.Info9
                }).regexValidator({
                            regExp:regexEnum.notempty,
                            onError:errmsg.Info3

                        }).regexValidator({
                            regExp:regexEnum.ip4,
                            onError:errmsg.Info1

                        });
                $("#id2037").formValidator({
                    onFocus:errmsg.Info8
                }).regexValidator({
                            regExp:regexEnum.notempty,
                            onError:errmsg.Info3

                        }).regexValidator({
                            regExp:regexEnum.ip4,
                            onError:errmsg.Info1

                        });
                $("#id2038").formValidator({
                    onFocus:errmsg.Info14
                }).regexValidator({
                            regExp:regexEnum.notempty,
                            onError:errmsg.Info3

                        }).regexValidator({
                            regExp:regexEnum.ip4,
                            onError:errmsg.Info1

                        });

                $("#id2025,#id2026,#id2027,#id2043,#id2044,#id2045").unFormValidator(true);
            },
            PPTP:function(){
                $("#3g_escape").hide();
                $("#divstaticid").hide();
                $("#divdhcpid").hide();
                $("#divpppoeid").hide();
                $("#divl2tpid").hide();
                $("#divpptpid").show();
                $("#div3gid").hide();
                $("#divmode").show();
                $("#id2043").formValidator({
                    onFocus:errmsg.Info9
                }).regexValidator({
                            regExp:regexEnum.notempty,
                            onError:errmsg.Info3

                        }).regexValidator({
                            regExp:regexEnum.ip4,
                            onError:errmsg.Info1

                        });
                $("#id2044").formValidator({
                    onFocus:errmsg.Info8
                }).regexValidator({
                            regExp:regexEnum.notempty,
                            onError:errmsg.Info3

                        }).regexValidator({
                            regExp:regexEnum.ip4,
                            onError:errmsg.Info1

                        });
                $("#id2045").formValidator({
                    onFocus:errmsg.Info14
                }).regexValidator({
                            regExp:regexEnum.notempty,
                            onError:errmsg.Info3

                        }).regexValidator({
                            regExp:regexEnum.ip4,
                            onError:errmsg.Info1

                        });

                $("#id2025,#id2026,#id2027,#id2036,#id2037,#id2038").unFormValidator(true);
            },
            DHCP:function(){
                $("#divstaticid").hide();
                $("#divdhcpid").show();
                $("#divpppoeid").hide();
                $("#divl2tpid").hide();
                $("#divpptpid").hide();
                $("#div3gid").hide();
                $("#mode").hide();
                $("#3g_escape").hide();
                $("#id2025,#id2026,#id2027,#id2036,#id2037,#id2038,#id2043,#id2044,#id2045").unFormValidator(true);

            },
            "3G":function(){
            $("#divstaticid").hide();
            $("#divdhcpid").hide();
            $("#divpppoeid").hide();
            $("#divl2tpid").hide();
            $("#divpptpid").hide();
            $("#div3gid").show();
            $("#mode").hide();
            $("#3g_escape").hide();
            $("#id2025,#id2026,#id2027,#id2036,#id2037,#id2038,#id2043,#id2044,#id2045").unFormValidator(true);


        },
            destroy  : function(){


            }



    };

        var id2024Value =$.trim($("#id2024").val());
        obj.condition = id2024Value;

        obj.excute();
    }
	
function read(){
		if($("#id2035_1").attr("checked")){
			$("#tr2036").show();
			$("#tr2037").show();
			$("#tr2038").show();
            $("#id2036,#id2037,#id2038").unFormValidator(false);
			}else if($("#id2035_2").attr("checked")){
			$("#tr2036").hide();
			$("#tr2037").hide();
			$("#tr2038").hide();
            $("#id2036,#id2037,#id2038").unFormValidator(true);
			}
		if($("#id2042_1").attr("checked")){
			$("#tr2043").show();
			$("#tr2044").show();
			$("#tr2045").show();
            $("#id2043,#id2044,#id2045").unFormValidator(false);
			}else if($("#id2042_2").attr("checked")){
			$("#tr2043").hide();
			$("#tr2044").hide();
			$("#tr2045").hide();
            $("#id2043,#id2044,#id2045").unFormValidator(true);
			}
		}
	

 
 function submitvalue(settext){
 	$(".errormsg").html('');
		settext=settext.replace(/\#/g,"%23");
		submitform(modules["set_data"],settext,"wan_main_load");
 	}
 	

	
</script>